using Vin.Tool.Core.JsonCategory;

namespace Vin.Extension.ServerSentEvent.Model;

public class SseMsg<T>
{
    public string? Id { get; set; }

    public string? Event { get; set; }

    public T? Data { get; set; }

    public string? Retry { get; set; }

    public SseMsg(string? id, string? @event, T? data, string? retry)
    {
        Id = id;
        Event = @event;
        Data = data;
        Retry = retry;
    }
    
    public SseMsg(T? data, string? @event)
    {
        Data = data;
        Event = @event;
    }
    
    public SseMsg(T? data)
    {
        Data = data;
    }
}

public class SseMsg : SseMsg<string>
{
    public SseMsg(string? id, string? @event, string? data, string? retry) : base(id, @event, data, retry)
    {
    }
    
    public SseMsg(string? data, string? @event) : base(data, @event)
    {
    }

    public SseMsg(string? data) : base(data)
    {
    }
}